import { fancyTimeFormat } from 'src/utils/common';
export default class Caption {
  public id = '';
  public startTime = 0;
  public duration = 0;
  public text = '';
  public cue: VTTCue | null = null;
  constructor(start: number, duration: number, text: string, id: string) {
    this.id = id;
    this.startTime = start;
    this.duration = duration;
    this.text = text;
  }
  public get startTimeStr(): string {
    return fancyTimeFormat(this.startTime);
  }
  public get endTimeStr(): string {
    return fancyTimeFormat(this.endTime);
  }
  public get endTime(): number {
    return this.startTime + this.duration;
  }
  public set endTime(time: number) {
    this.duration = time - this.startTime;
  }
}
